<?php

namespace App\Admin\Controllers;

use Encore\Admin\Grid;
use App\Models\InvitePoster;
use Encore\Admin\Controllers\AdminController;

class InvitePostersController extends AdminController
{
    protected $title = '邀请海报';

    protected function grid()
    {
        $grid = new Grid(new InvitePoster());

        $grid->column('id', 'ID');
        $grid->column('user_id', '会员');
        $grid->column('final_poster', '海报')->image('', 100, 100);
        $grid->column('brief', '摘要');
        $grid->column('created_at', '创建')->display(function () {
        	return $this->created_at->toDatetimeString();
        });
        
        $grid->disableFilter();
        $grid->disableExport();
        $grid->disableRowSelector();
        $grid->disableCreateButton();
        $this->gridActions($grid);

        return $grid;
    }
    
    protected function gridActions(Grid $grid)
    {
	    $grid->actions(function (Grid\Displayers\Actions $actions) {
	    	$actions->disableView();
	    	$actions->disableEdit();
	    	$actions->disableDelete();
	    });
    }
}
